<%-- 
    Document   : Home
    Created on : Dec 3, 2012, 6:52:31 PM
    Author     : Quang Thao
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%
    //response.sendRedirect("../Book/ListBookSpecial.jsp?state=01");
%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Home</title>
        <%@include file="../LayoutUser/InHead.jsp" %>
    </head>
    <body>
        <div id="wrapper">
            <%@include file="../LayoutUser/Top.jsp" %>
            <div id="middle">
                <%@include file="../LayoutUser/Middle_Top.jsp" %>
                <div class="left">
                    <%
                        BO.BookBO bookBO = new BO.BookBO();
                        List list2 = new ArrayList<Bean.BookBean>();
                        list2 = bookBO.GetAll();
                        Bean.BookBean temp = null;
                        try
                        {
                            temp = (Bean.BookBean) list2.get(0);
                        }
                        catch (Exception ex)
                        {
                        }
                        for (int i=0;i<list2.size();i++)
                        {
                            Bean.BookBean book = (Bean.BookBean) list2.get(i);
                            %>
                            
                            <div class="Product">
                                <div class="Picture">
                                    <img src="<% out.print("../../Content/Images/Book/" + book.getPicture());%>" width="100%" height="100%"/>

                                </div>
                                <div class="Name">
                                    <% 
                                        if (book.getName().length() > 30)
                                            out.print(book.getName().substring(0,30) + " ...");
                                        else
                                            out.print(book.getName());
                                    %>
                                </div>
                                <div>
                                    <% 
                                        out.print(String.format("%,4.0f VNĐ",book.getCost()));
                                    %>
                                </div>
                                <div>
                                    <a href="<%out.print("../Cart/Detail.jsp?isbn=" + book.getISBN());%>">
                                        <input type="button" value="Mua" name="btnBuy" class="Button1"/>
                                    </a>
                                    &nbsp;
                                    <a href="<%out.print("../Book/Detail.jsp?mode=user&isbn=" + book.getISBN());%>">
                                        <input type="button" value="Chi tiết" name="btnDetail" class="Button1"/>
                                    </a>
                                </div>
                            </div>
                        <%}
                    %>          
                </div>
                <%@include file="../LayoutUser/Middle_Right.jsp" %>
            </div>
            <%@include file="../LayoutUser/Bottom.jsp" %>
        </div>
    </body>
</html>
